#ifndef CSCENE_H
#define CSCENE_H

#include <QGraphicsScene>
#include <QMutex>

#include "OpenCV.h"
#include "artoolkitapi.h"
#include "lib3ds.h"
#include "coldet.h"


class QPixmap;


typedef struct {
//    typedef float Lib3dsVector[3];
//    typedef float Lib3dsTexel[2];
    Lib3dsFile* model;
    Lib3dsMesh** mesh;
    Lib3dsCamera** camera;
    Lib3dsFace* face;
    Lib3dsLight** light;
    Lib3dsMaterial** material;
    unsigned long total_face;
} object3ds;


class CScene : public QGraphicsScene
{
        Q_OBJECT

public:
        CScene(QObject *parent = 0);
        ~CScene();

public:
        bool StartCapture(int width, int height);
        bool StopCapture();
        void ChangeChildValues(double l, double r);

private:
        void drawBackground(QPainter *painter, const QRectF &rect);
        void DrawOtherThings(object3ds *todraw, float modelScale);
        void forCollision(CollisionModel3D *toaddto, object3ds *todraw, float scaleFactor);
        void checkCollisions();
        void getfaces(object3ds *todraw);
        void loadModel(char *name, object3ds *modelling);

private:
        QMutex			m_MutexPaint;
        ARToolkitAPI            *m_NyART;
        COpenCV			m_OpenCV;
};

#endif // CSCENE_H
